package com.shidaimanong.mapper;

import com.shidaimanong.entity.Blog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 学编程，关注：十代码农
 * 抖音、快手、B站、西瓜视频、今日头条
 */
@Repository
public interface BlogMapper {
    @Select(value = "select * from blog where id = #{id}")
    Blog query(@Param("id") int id);

    @Select(value = "select * from blog")
    List<Blog> queryAll();

    @Insert(value = "insert into blog(title,content) values (#{title}, #{content})")
    void add(@Param("title") String title, @Param("content") String content);


    @Update(value = "update blog set title=#{title},content=#{content} where id = #{id}")
    void modify(@Param("id") int id, @Param("title") String title, @Param("content") String content);

    @Delete("delete from blog where id = #{id}")
    void del(@Param("id") int id);
}
